package com.ygqh.baby.mapper;

import com.ygqh.baby.ao.QueryInfo;
import com.ygqh.baby.model.YgChannelBalance;
import com.ygqh.baby.po.YgChannel;
import com.ygqh.baby.po.YgChannelExample;
import com.ygqh.baby.po.YgUser;
import com.ygqh.baby.po.YgUserOpen;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface YgChannelMapper {
	int countByExample(YgChannelExample example);

	int deleteByExample(YgChannelExample example);

	int deleteByPrimaryKey(Long id);

	int insert(YgChannel record);

	int insertSelective(YgChannel record);

	List<YgChannel> selectByExample(YgChannelExample example);

	YgChannel selectByPrimaryKey(Long id);

	int updateByExampleSelective(@Param("record") YgChannel record, @Param("example") YgChannelExample example);

	int updateByExample(@Param("record") YgChannel record, @Param("example") YgChannelExample example);

	int updateByPrimaryKeySelective(YgChannel record);

	int updateByPrimaryKey(YgChannel record);

	int countSuper(@Param("categoryId") Long categoryId, @Param("sourceCode") String sourceCode, @Param("q") String q);

	List<YgChannel> selectSuper(@Param("queryInfo") QueryInfo queryInfo, @Param("categoryId") Long categoryId, @Param("sourceCode") String sourceCode,
			@Param("q") String q);

	List<String> findSourceCodeWithParent(@Param("userId") Long userId);

	List<YgChannel> selectChannelDetailByParent(@Param("parentId") Long parentId);

	List<YgChannel> selectByParentId(@Param("parentId") Long parentId);

	List<YgUser> findChannelRegAmount(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

	List<YgUserOpen> findChannelScanAmount(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

	int updateScanAmountBatch(@Param("channelList") List<YgChannel> channelList);

	void executeChannelScanAndRegTask(@Param("startDate") Date startDate, @Param("endDate") Date endDate);

    List<YgChannelBalance> findAllChildChannel();

	YgChannelBalance findChannelBalanceByParentId(@Param("parentId")Long parentId);
}
